/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "transaction")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Transaction.findAll", query = "SELECT t FROM Transaction t"),
    @NamedQuery(name = "Transaction.findByIdTransaction", query = "SELECT t FROM Transaction t WHERE t.idTransaction = :idTransaction"),
    @NamedQuery(name = "Transaction.findByIntitule", query = "SELECT t FROM Transaction t WHERE t.intitule = :intitule"),
    @NamedQuery(name = "Transaction.findByDate", query = "SELECT t FROM Transaction t WHERE t.date = :date"),
    @NamedQuery(name = "Transaction.findByMontant", query = "SELECT t FROM Transaction t WHERE t.montant = :montant"),
    @NamedQuery(name = "Transaction.findByType", query = "SELECT t FROM Transaction t WHERE t.type = :type")
})
public class Transaction implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTransaction")
    private Integer idTransaction;
    @Column(name = "intitule")
    private String intitule;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "montant")
    private Float montant;
    @Column(name = "type")
    private String type;
    @JoinColumn(name = "saison_idSaison", referencedColumnName = "idSaison")
    @ManyToOne(optional = false)
    private Saison saisonidSaison;

    public Transaction()
    {
    }

    public Transaction(Integer idTransaction)
    {
        this.idTransaction = idTransaction;
    }

    public Integer getIdTransaction()
    {
        return idTransaction;
    }

    public void setIdTransaction(Integer idTransaction)
    {
        this.idTransaction = idTransaction;
    }

    public String getIntitule()
    {
        return intitule;
    }

    public void setIntitule(String intitule)
    {
        this.intitule = intitule;
    }

    public Date getDate()
    {
        return date;
    }

    public void setDate(Date date)
    {
        this.date = date;
    }

    public Float getMontant()
    {
        return montant;
    }

    public void setMontant(Float montant)
    {
        this.montant = montant;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public Saison getSaisonidSaison()
    {
        return saisonidSaison;
    }

    public void setSaisonidSaison(Saison saisonidSaison)
    {
        this.saisonidSaison = saisonidSaison;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idTransaction != null ? idTransaction.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transaction))
        {
            return false;
        }
        Transaction other = (Transaction) object;
        if ((this.idTransaction == null && other.idTransaction != null) || (this.idTransaction != null && !this.idTransaction.equals(other.idTransaction)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Transaction[ idTransaction=" + idTransaction + " ]";
    }
    
}
